<?php include "../db/db_connect.php"; ?>

<?php
    $username = trim($_POST["username"]);
    $password = md5($_POST["password"]);
	
	$qry = "insert into user set user_name=\"{$username}\", user_password=\"{$password}\"";
	if (!mysql_query($qry, $con)) {
        $error = "error";	
	}
?>

<?php include "../db/db_close.php"; ?>

<?php
    if (isset($error)) { // username and password match
	    header("Location: ../../login.php?operation=" . "sign_up");
	}
	else {
	    session_start();
		$_SESSION['uid'] = $username;
        header("Location: ../../index.php");
	}
?>